package com.yefeng.usercenter.domain.response;

import com.yefeng.usercenter.exception.enums.ErrorCode;
import lombok.Data;

import java.io.Serializable;

/**
 * @author 叶枫
 * @date 2024/4/7.
 */

@Data
public class BaseResponse<T> implements Serializable {
    /** 错误编码*/
    private  int code;
    /**数据*/
    private T data;
    /**错误信息*/
   private String message;
   /**错误描述*/
   private String description;

    public BaseResponse(int code, T data, String message, String description) {
        this.code = code;
        this.data = data;
        this.message = message;
        this.description = description;
    }
    public BaseResponse(int code, T data){
        this(code,data,"","");
    }
    public BaseResponse (int code, T data, String message){
        this(code, data, message, "");
    }
    public BaseResponse(ErrorCode errorCode){
        this(errorCode.getCode(),null,errorCode.getMessage(),"");
    }

}
